#include "edgeGraph.h"
#include <stdlib.h>

PedgeGraph initEdgeGraph(int t, int d, float p){
	PedgeGraph result = (PedgeGraph)malloc(sizeof(EdgeGraph));
	checkMalloc(result,"graph.c:initEdge:1");
	result->d=d;
	result->p=p;
	result->t=t;
	return result;
}

//TODO testing
void freeEdgeGraph(PedgeGraph pe){
	free(pe);
}

bool isEdgeGraphProfitable(PedgeGraph peg) {
	return peg->p && peg->d;
}

bool isEdgeGraphExist(PedgeGraph pe){
	return pe->t >= INFINITE;
}

void printEdgeGraph(FILE* f, PedgeGraph pe) {
	fprintf(f, "t=%d, d=%d, p=%2.0f\n", pe->t, pe->d, pe->p);
}
